layui.use(['form', 'xmSelect', 'upload', 'laydate'], function () {
    var form = layui.form;
    laydate = layui.laydate;


    //提交事件
    form.on('submit(submit)', function (data) {
        console.log(data.field)
        let params = data.field
        params.status = params.status == 'on' ? 0 : 1
        if ($('#infoType').val() == 'edit') {
            params.id = $('#userId').val()
        }

        AjaxPost($('#infoType').val() == 'add' ? '/jazUserCommentClassify/save' : '/jazUserCommentClassify/update', params).then(function (response) {
            parent.layer.msg("操作成功");
            var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
            parent.layer.close(index);
            parent.load();
        }).catch(error => {
            layer.msg(error.msg)
        })

    });

});

